strptime.h
dg-100.o: dg-100.cc defs.h config.h zlib/zlib.h zlib/zconf.h formspec.h \
inifile.h gbfile.h session.h src/core/datetime.h src/core/optional.h \
- gbser.h
+ dg-100.h format.h gbser.h
discard.o: discard.cc defs.h config.h zlib/zlib.h zlib/zconf.h formspec.h \
inifile.h gbfile.h session.h src/core/datetime.h src/core/optional.h \
discard.h filter.h
duplicate.h height.h heightgrid.h interpolate.h nukedata.h polygon.h \
position.h radius.h reverse_route.h smplrout.h sort.h stackfilter.h \
swapdata.h trackfilter.h transform.h validate.h gbversion.h vecs.h \
- format.h energympro.h garmin_fit.h geojson.h src/core/file.h ggv_bin.h \
- globalsat_sport.h gpx.h src/core/xmlstreamwriter.h src/core/xmltag.h \
- kml.h xmlgeneric.h legacyformat.h lowranceusr.h mynav.h nmea.h \
- qstarz_bl_1000.h random.h shape.h shapelib/shapefil.h subrip.h \
- unicsv.h src/core/textstream.h xcsv.h garmin_fs.h jeeps/gps.h \
+ dg-100.h format.h energympro.h garmin_fit.h geojson.h src/core/file.h \
+ ggv_bin.h globalsat_sport.h gpx.h src/core/xmlstreamwriter.h \
+ src/core/xmltag.h kml.h xmlgeneric.h legacyformat.h lowranceusr.h \
+ mynav.h nmea.h qstarz_bl_1000.h random.h shape.h shapelib/shapefil.h \
+ subrip.h unicsv.h src/core/textstream.h xcsv.h garmin_fs.h jeeps/gps.h \
jeeps/../defs.h jeeps/gpsport.h jeeps/gpsdevice.h jeeps/gpssend.h \
jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \
jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsmem.h \
jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \
jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsmem.h \
jeeps/gpsrqst.h garmin_tables.h grtcirc.h jeeps/gpsserial.h vecs.h \
- energympro.h garmin_fit.h geojson.h src/core/file.h ggv_bin.h \
+ dg-100.h energympro.h garmin_fit.h geojson.h src/core/file.h ggv_bin.h \
globalsat_sport.h gpx.h src/core/xmlstreamwriter.h src/core/xmltag.h \
kml.h xmlgeneric.h legacyformat.h lowranceusr.h mynav.h nmea.h \
qstarz_bl_1000.h random.h shape.h shapelib/shapefil.h subrip.h \
magproto.o: magproto.cc defs.h config.h zlib/zlib.h zlib/zconf.h \
formspec.h inifile.h gbfile.h session.h src/core/datetime.h \
src/core/optional.h explorist_ini.h format.h gbser.h magellan.h vecs.h \
- energympro.h garmin_fit.h geojson.h src/core/file.h ggv_bin.h \
+ dg-100.h energympro.h garmin_fit.h geojson.h src/core/file.h ggv_bin.h \
globalsat_sport.h gpx.h src/core/xmlstreamwriter.h src/core/xmltag.h \
kml.h xmlgeneric.h legacyformat.h lowranceusr.h mynav.h nmea.h \
qstarz_bl_1000.h random.h shape.h shapelib/shapefil.h subrip.h \
discard.h duplicate.h height.h heightgrid.h interpolate.h nukedata.h \
polygon.h position.h radius.h reverse_route.h smplrout.h sort.h \
stackfilter.h swapdata.h trackfilter.h transform.h validate.h format.h \
- src/core/file.h src/core/usasciicodec.h vecs.h energympro.h \
+ src/core/file.h src/core/usasciicodec.h vecs.h dg-100.h energympro.h \
garmin_fit.h geojson.h ggv_bin.h globalsat_sport.h gpx.h \
src/core/xmlstreamwriter.h src/core/xmltag.h kml.h xmlgeneric.h \
legacyformat.h lowranceusr.h mynav.h nmea.h qstarz_bl_1000.h random.h \
jeeps/gpsmath.h jeeps/gpsport.h
vecs.o: vecs.cc defs.h config.h zlib/zlib.h zlib/zconf.h formspec.h \
inifile.h gbfile.h session.h src/core/datetime.h src/core/optional.h \
- vecs.h format.h energympro.h garmin_fit.h geojson.h src/core/file.h \
- ggv_bin.h globalsat_sport.h gpx.h src/core/xmlstreamwriter.h \
- src/core/xmltag.h kml.h xmlgeneric.h legacyformat.h lowranceusr.h \
- mynav.h nmea.h qstarz_bl_1000.h random.h shape.h shapelib/shapefil.h \
- subrip.h unicsv.h src/core/textstream.h xcsv.h garmin_fs.h jeeps/gps.h \
- jeeps/../defs.h jeeps/gpsport.h jeeps/gpsdevice.h jeeps/gpssend.h \
- jeeps/gpsread.h jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h \
- jeeps/gpscom.h jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsmem.h \
- jeeps/gpsrqst.h yahoo.h gbversion.h src/core/logging.h
+ vecs.h dg-100.h format.h energympro.h garmin_fit.h geojson.h \
+ src/core/file.h ggv_bin.h globalsat_sport.h gpx.h \
+ src/core/xmlstreamwriter.h src/core/xmltag.h kml.h xmlgeneric.h \
+ legacyformat.h lowranceusr.h mynav.h nmea.h qstarz_bl_1000.h random.h \
+ shape.h shapelib/shapefil.h subrip.h unicsv.h src/core/textstream.h \
+ xcsv.h garmin_fs.h jeeps/gps.h jeeps/../defs.h jeeps/gpsport.h \
+ jeeps/gpsdevice.h jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h \
+ jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h \
+ jeeps/gpsmath.h jeeps/gpsmem.h jeeps/gpsrqst.h yahoo.h gbversion.h \
+ src/core/logging.h
vidaone.o: vidaone.cc defs.h config.h zlib/zlib.h zlib/zconf.h formspec.h \
inifile.h gbfile.h session.h src/core/datetime.h src/core/optional.h
vitosmt.o: vitosmt.cc defs.h config.h zlib/zlib.h zlib/zconf.h formspec.h \
#include <QtCore/QScopedArrayPointer> // for QScopedArrayPointer
#include <QtCore/QString> // for QString
#include <QtCore/QTime> // for QTime
-#include <QtCore/QVector> // for QVector
#include <QtCore/Qt> // for TextDate, UTC
#include <QtCore/QtGlobal> // for qPrintable
#include "defs.h"
+#include "dg-100.h"
#include "gbfile.h" // for gbfread, gbfclose, gbfgetc, gbfopen, gbfile
#include "gbser.h" // for gbser_deinit, gbser_flush, gbser_init, gbser_read_wait, gbser_readc_wait, gbser_set_speed, gbser_write, gbser_ERROR, gbser_OK, gbser_NOTHING
#define MYNAME "DG-100"
-struct model_t {
- const char *name;
- unsigned speed;
- int has_trailing_bytes;
- int has_payload_end_seq;
- struct dg100_command *commands;
- unsigned int numcommands;
-};
-
-static const model_t* model;
-
-static void* serial_handle;
-
-static gbfile* fin{nullptr};
-static bool isfile{false};
-
-/* maximum frame size observed so far: 1817 bytes
- * (dg100cmd_getfileheader returning 150 entries)
- * dg100cmd_getfileheader is the only answer type of variable length,
- * answers of other types are always shorter than 1817 bytes */
-#define FRAME_MAXLEN 4096
-
-enum dg100_command_id {
- dg100cmd_getconfig = 0xB7,
- dg100cmd_setconfig = 0xB8,
- dg100cmd_getfileheader = 0xBB,
- dg100cmd_getfile = 0xB5,
- dg100cmd_erase = 0xBA,
- dg100cmd_getid = 0xBF,
- dg100cmd_setid = 0xC0,
- dg100cmd_gpsmouse = 0xBC,
- dg200cmd_reset = 0x80
-};
-
-struct dg100_command {
- int id;
- int sendsize;
- int recvsize;
- int trailing_bytes;
- const char* text; /* Textual description for debugging */
-};
-
-static struct dg100_command dg100_commands[] = {
+const Dg100Format::dg100_command Dg100Format::dg100_commands[] = {
{ dg100cmd_getfile, 2, 1024, 2, "getfile" },
/* the getfileheader answer has variable length, -1 is a dummy value */
{ dg100cmd_getfileheader, 2, -1, 2, "getfileheader" },
{ dg100cmd_gpsmouse, 1, 0, 0, "gpsmouse" }
};
-static struct dg100_command dg200_commands[] = {
+const Dg100Format::dg100_command Dg100Format::dg200_commands[] = {
{ dg100cmd_getfile, 2, 1024, 2, "getfile" },
/* the getfileheader answer has variable length, -1 is a dummy value */
{ dg100cmd_getfileheader, 2, -1, 2, "getfileheader" },
};
/* helper functions */
-static struct dg100_command*
-dg100_findcmd(int id) {
+const Dg100Format::dg100_command*
+Dg100Format::dg100_findcmd(int id) const
+{
/* linear search should be OK as long as dg100_numcommands is small */
for (unsigned int i = 0; i < model->numcommands; i++) {
if (model->commands[i].id == id) {
return nullptr;
}
-static QDateTime
-bintime2utc(int date, int time)
+QDateTime
+Dg100Format::bintime2utc(int date, int time)
{
int sec = time % 100;
time /= 100;
return QDateTime(QDate(year, mon, day), QTime(hour, min, sec), Qt::UTC);
}
-static void
-dg100_debug(const char* hdr, int include_nl, size_t sz, unsigned char* buf)
+void
+Dg100Format::dg100_debug(const char* hdr, int include_nl, size_t sz, unsigned char* buf)
{
/* Only give byte dumps for higher debug levels */
if (global_opts.debug_level < 5) {
}
}
-static void
-dg100_log(const char* fmt, ...)
+void
+Dg100Format::dg100_log(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
/* TODO: check whether negative lat/lon (West/South) are handled correctly */
-static float
-bin2deg(int val)
+float
+Dg100Format::bin2deg(int val) const
{
/* Assume that val prints in decimal digits as [-]dddmmffff
* ddd: degrees
return(deg);
}
-static void
-process_gpsfile(uint8_t data[], route_head** track)
+void
+Dg100Format::process_gpsfile(uint8_t data[], route_head** track) const
{
const int recordsizes[3] = {8, 20, 32};
}
}
-static uint16_t
-dg100_checksum(const uint8_t buf[], int count)
+uint16_t
+Dg100Format::dg100_checksum(const uint8_t buf[], int count)
{
uint16_t sum = 0;
}
/* communication functions */
-static size_t
-dg100_send(uint8_t cmd, const void* payload, size_t param_len)
+size_t
+Dg100Format::dg100_send(uint8_t cmd, const void* payload, size_t param_len) const
{
uint8_t frame[FRAME_MAXLEN];
}
if (global_opts.debug_level) {
- struct dg100_command* cmdp = dg100_findcmd(cmd);
+ const dg100_command* cmdp = dg100_findcmd(cmd);
dg100_debug(n == 0 ? "Sent: " : "Error Sending:",
1, framelen, frame);
return (n);
}
-static int
-dg100_recv_byte()
+int
+Dg100Format::dg100_recv_byte() const
{
int result;
if (isfile) {
return result;
}
-static int
-dg100_read_wait(void* handle, void* buf, unsigned len, unsigned ms)
+int
+Dg100Format::dg100_read_wait(void* handle, void* buf, unsigned len, unsigned ms) const
{
if (isfile) {
return gbfread(buf, 1, len, fin);
/* payload returns a pointer into a static buffer (which also contains the
* framing around the data), so the caller must copy the data before calling
* this function again */
-static int
-dg100_recv_frame(struct dg100_command** cmdinfo_result, uint8_t** payload)
+int
+Dg100Format::dg100_recv_frame(const dg100_command** cmdinfo_result, uint8_t** payload) const
{
static uint8_t buf[FRAME_MAXLEN];
uint16_t payload_end_seq;
cmd = dg100cmd_setconfig;
}
- struct dg100_command* cmdinfo = dg100_findcmd(cmd);
+ const dg100_command* cmdinfo = dg100_findcmd(cmd);
if (!cmdinfo) {
/* TODO: consume data until frame end signature,
* then report failure to the caller? */
}
/* return value: number of bytes copied into buf, -1 on error */
-static int
-dg100_recv(uint8_t expected_id, void* buf, unsigned int len)
+int
+Dg100Format::dg100_recv(uint8_t expected_id, void* buf, unsigned int len) const
{
- struct dg100_command* cmdinfo;
+ const dg100_command* cmdinfo;
uint8_t* data;
int n = dg100_recv_frame(&cmdinfo, &data);
/* the number of bytes to be sent is determined by cmd,
* count is the size of recvbuf */
-static int
-dg100_request(uint8_t cmd, const void* sendbuf, void* recvbuf, size_t count)
+int
+Dg100Format::dg100_request(uint8_t cmd, const void* sendbuf, void* recvbuf, size_t count) const
{
- struct dg100_command* cmdinfo = dg100_findcmd(cmd);
+ const dg100_command* cmdinfo = dg100_findcmd(cmd);
assert(cmdinfo != nullptr);
dg100_send(cmd, sendbuf, cmdinfo->sendsize);
}
/* higher level communication functions */
-static QList<int>
-dg100_getfileheaders()
+QList<int>
+Dg100Format::dg100_getfileheaders() const
{
QList<int> headers;
uint8_t request[2];
return headers;
}
-static void
-dg100_getconfig()
+void
+Dg100Format::dg100_getconfig() const
{
uint8_t answer[45];
dg100_request(dg100cmd_getconfig, nullptr, answer, sizeof(answer));
}
-static void
-dg100_getfile(int16_t num, route_head** track)
+void
+Dg100Format::dg100_getfile(int16_t num, route_head** track) const
{
uint8_t request[2];
uint8_t answer[2048];
process_gpsfile(answer, track);
}
-static void
-dg100_getfiles()
+void
+Dg100Format::dg100_getfiles() const
{
route_head* track = nullptr;
}
}
-static int
-dg100_erase()
+int
+Dg100Format::dg100_erase() const
{
uint8_t request[2] = { 0xFF, 0xFF };
uint8_t answer[4];
return(0);
}
-/* GPSBabel integration */
-
-static char* erase;
-static char* erase_only;
-
-static
-QVector<arglist_t> dg100_args = {
- {
- "erase", &erase, "Erase device data after download",
- "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
- },
- {
- "erase_only", &erase_only, "Only erase device data, do not download anything",
- "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
- },
-};
-
/*******************************************************************************
* %%% global callbacks called by gpsbabel main process %%% *
*******************************************************************************/
-static void
-common_rd_init(const QString& fname)
+void
+Dg100Format::common_rd_init(const QString& fname)
{
if (isfile) {
fin = gbfopen(fname, "rb", MYNAME);
}
}
-static void
-dg100_rd_init(const QString& fname)
+void
+Dg100Format::dg100_rd_init(const QString& fname, bool isfile)
{
- static const model_t dg100_model = { "DG-100", 115200, 1, 1, dg100_commands, sizeof(dg100_commands) / sizeof(struct dg100_command) };
+ static const model_t dg100_model = { "DG-100", 115200, true, true, dg100_commands, sizeof(dg100_commands) / sizeof(dg100_command) };
model = &dg100_model;
+ this->isfile = isfile;
common_rd_init(fname);
}
-static void
-dg100_rd_serial_init(const QString& fname)
-{
- isfile = false;
- dg100_rd_init(fname);
-}
-
-static void
-dg100_rd_file_init(const QString& fname)
-{
- isfile = true;
- dg100_rd_init(fname);
-}
-
-static void
-dg200_rd_init(const QString& fname)
+void
+Dg100Format::dg200_rd_init(const QString& fname, bool isfile)
{
- static const model_t dg200_model = { "DG-200", 230400, 0, 0, dg200_commands, sizeof(dg200_commands) / sizeof(struct dg100_command) };
+ static const model_t dg200_model = { "DG-200", 230400, false, false, dg200_commands, sizeof(dg200_commands) / sizeof(dg100_command) };
model = &dg200_model;
+ this->isfile = isfile;
common_rd_init(fname);
}
-static void
-dg200_rd_serial_init(const QString& fname)
-{
- isfile = false;
- dg200_rd_init(fname);
-}
-
-static void
-dg200_rd_file_init(const QString& fname)
-{
- isfile = true;
- dg200_rd_init(fname);
-}
-
-static void
-dg100_rd_deinit()
+void
+Dg100Format::rd_deinit()
{
if (isfile) {
gbfclose(fin);
}
}
-static void
-dg100_read()
+void
+Dg100Format::read()
{
if (*erase_only == '1') {
dg100_erase();
dg100_erase();
}
}
-
-/**************************************************************************/
-
-// capabilities below means: we can read tracks and waypoints
-
-ff_vecs_t dg100_vecs = {
- ff_type_serial,
- {
- ff_cap_read /* waypoints */,
- ff_cap_read /* tracks */,
- ff_cap_none /* routes */
- },
- dg100_rd_serial_init,
- nullptr,
- dg100_rd_deinit,
- nullptr,
- dg100_read,
- nullptr,
- nullptr,
- &dg100_args,
- CET_CHARSET_ASCII, 0 /* ascii is the expected character set */
- /* not fixed, can be changed through command line parameter */
- , NULL_POS_OPS,
- nullptr
-};
-
-ff_vecs_t dg100_fvecs = {
- ff_type_internal, /* This is a regression test, hide from GUI. */
- {
- ff_cap_read /* waypoints */,
- ff_cap_read /* tracks */,
- ff_cap_none /* routes */
- },
- dg100_rd_file_init,
- nullptr,
- dg100_rd_deinit,
- nullptr,
- dg100_read,
- nullptr,
- nullptr,
- &dg100_args,
- CET_CHARSET_ASCII, 0 /* ascii is the expected character set */
- /* not fixed, can be changed through command line parameter */
- , NULL_POS_OPS,
- nullptr
-};
-
-ff_vecs_t dg200_vecs = {
- ff_type_serial,
- {
- ff_cap_read /* waypoints */,
- ff_cap_read /* tracks */,
- ff_cap_none /* routes */
- },
- dg200_rd_serial_init,
- nullptr,
- dg100_rd_deinit,
- nullptr,
- dg100_read,
- nullptr,
- nullptr,
- &dg100_args,
- CET_CHARSET_ASCII, 0 /* ascii is the expected character set */
- /* not fixed, can be changed through command line parameter */
- , NULL_POS_OPS,
- nullptr
-};
-
-ff_vecs_t dg200_fvecs = {
- ff_type_internal, /* This is a regression test, hide from GUI. */
- {
- ff_cap_read /* waypoints */,
- ff_cap_read /* tracks */,
- ff_cap_none /* routes */
- },
- dg200_rd_file_init,
- nullptr,
- dg100_rd_deinit,
- nullptr,
- dg100_read,
- nullptr,
- nullptr,
- &dg100_args,
- CET_CHARSET_ASCII, 0 /* ascii is the expected character set */
- /* not fixed, can be changed through command line parameter */
- , NULL_POS_OPS,
- nullptr
-};
-/**************************************************************************/
--- /dev/null
+/*
+
+ GlobalSat DG-100/DG-200 GPS data logger download.
+
+ Copyright (C) 2007 Mirko Parthey, mirko.parthey@informatik.tu-chemnitz.de
+ Copyright (C) 2005-2008 Robert Lipe, robertlipe+source@gpsbabel.org
+ Copyright (C) 2012 Nicolas Boullis, nboullis@debian.org
+ Copyright (C) 2014 Jean-Claude Repetto, gpsbabel@repetto.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+/*
+ DG-100 / DG-200 communication protocol specification:
+ http://www.usglobalsat.com/s-176-developer-information.aspx
+ */
+#ifndef DG100_H_INCLUDED_
+#define DG100_H_INCLUDED_
+
+#include <cstdint> // for uint8_t, int16_t, uint16_t
+#include <cstdio> // for size_t
+
+#include <QtCore/QDateTime> // for QDateTime
+#include <QtCore/QList> // for QList
+#include <QtCore/QString> // for QString
+#include <QtCore/QVector> // for QVector
+
+#include "defs.h"
+#include "format.h" // for Format
+#include "gbfile.h" // for gbfile
+
+
+class Dg100Format : public Format
+{
+public:
+ /* Member Functions */
+
+ QVector<arglist_t>* get_args() override
+ {
+ return &dg100_args;
+ }
+
+ QVector<ff_cap> get_cap() const override
+ {
+ return {
+ ff_cap_read /* waypoints */,
+ ff_cap_read /* tracks */,
+ ff_cap_none /* routes */
+ };
+ }
+
+ QString get_encode() const override
+ {
+ return CET_CHARSET_ASCII;
+ }
+
+ int get_fixed_encode() const override
+ {
+ return 0;
+ }
+
+ void read() override;
+ void rd_deinit() override;
+
+protected:
+ /* Types */
+
+ enum dg100_command_id {
+ dg100cmd_getconfig = 0xB7,
+ dg100cmd_setconfig = 0xB8,
+ dg100cmd_getfileheader = 0xBB,
+ dg100cmd_getfile = 0xB5,
+ dg100cmd_erase = 0xBA,
+ dg100cmd_getid = 0xBF,
+ dg100cmd_setid = 0xC0,
+ dg100cmd_gpsmouse = 0xBC,
+ dg200cmd_reset = 0x80
+ };
+
+ struct dg100_command {
+ int id;
+ int sendsize;
+ int recvsize;
+ int trailing_bytes;
+ const char* text; /* Textual description for debugging */
+ };
+
+ struct model_t {
+ const char* name;
+ unsigned speed;
+ bool has_trailing_bytes;
+ bool has_payload_end_seq;
+ const dg100_command* commands;
+ unsigned int numcommands;
+ };
+
+ /* Constants */
+
+ /* maximum frame size observed so far: 1817 bytes
+ * (dg100cmd_getfileheader returning 150 entries)
+ * dg100cmd_getfileheader is the only answer type of variable length,
+ * answers of other types are always shorter than 1817 bytes */
+ static constexpr int FRAME_MAXLEN = 4096;
+
+ /* Member Functions */
+
+ const dg100_command* dg100_findcmd(int id) const;
+ static QDateTime bintime2utc(int date, int time);
+ static void dg100_debug(const char* hdr, int include_nl, size_t sz, unsigned char* buf);
+ static void dg100_log(const char* fmt, ...);
+ float bin2deg(int val) const;
+ void process_gpsfile(uint8_t* data, route_head** track) const;
+ static uint16_t dg100_checksum(const uint8_t* buf, int count);
+ size_t dg100_send(uint8_t cmd, const void* payload, size_t param_len) const;
+ int dg100_recv_byte() const;
+ int dg100_read_wait(void* handle, void* buf, unsigned int len, unsigned int ms) const;
+ int dg100_recv_frame(const dg100_command** cmdinfo_result, uint8_t** payload) const;
+ int dg100_recv(uint8_t expected_id, void* buf, unsigned int len) const;
+ int dg100_request(uint8_t cmd, const void* sendbuf, void* recvbuf, size_t count) const;
+ QList<int> dg100_getfileheaders() const;
+ void dg100_getconfig() const;
+ void dg100_getfile(int16_t num, route_head** track) const;
+ void dg100_getfiles() const;
+ int dg100_erase() const;
+ void common_rd_init(const QString& fname);
+ void dg100_rd_init(const QString& fname, bool isfile);
+ void dg200_rd_init(const QString& fname, bool isfile);
+
+ /* Data Members */
+
+ const model_t* model{nullptr};
+ void* serial_handle{nullptr};
+ gbfile* fin{nullptr};
+ bool isfile{false};
+
+ static const dg100_command dg100_commands[];
+ static const dg100_command dg200_commands[];
+
+ /* GPSBabel integration */
+
+ char* erase{nullptr};
+ char* erase_only{nullptr};
+
+ QVector<arglist_t> dg100_args = {
+ {
+ "erase", &erase, "Erase device data after download",
+ "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
+ },
+ {
+ "erase_only", &erase_only, "Only erase device data, do not download anything",
+ "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
+ },
+ };
+
+};
+
+class Dg100SerialFormat : public Dg100Format
+{
+public:
+
+ ff_type get_type() const override
+ {
+ return ff_type_serial;
+ }
+
+ void rd_init(const QString& fname) override
+ {
+ dg100_rd_init(fname, false);
+ }
+};
+
+class Dg100FileFormat : public Dg100Format
+{
+public:
+
+ ff_type get_type() const override
+ {
+ return ff_type_internal;
+ }
+
+ void rd_init(const QString& fname) override
+ {
+ dg100_rd_init(fname, true);
+ }
+};
+
+class Dg200SerialFormat : public Dg100Format
+{
+public:
+
+ ff_type get_type() const override
+ {
+ return ff_type_serial;
+ }
+
+ void rd_init(const QString& fname) override
+ {
+ dg200_rd_init(fname, false);
+ }
+};
+
+class Dg200FileFormat : public Dg100Format
+{
+public:
+
+ ff_type get_type() const override
+ {
+ return ff_type_internal;
+ }
+
+ void rd_init(const QString& fname) override
+ {
+ dg200_rd_init(fname, true);
+ }
+};
+#endif // DG100_H_INCLUDED_